-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Mention extension in unused param warning #23132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with the minor nitpick
//println(infos.defs.mkString("DEFS\n", "\n", "\n---")) | ||
//println(infos.refs.mkString("REFS\n", "\n", "\n---")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//println(infos.defs.mkString("DEFS\n", "\n", "\n---")) | |
//println(infos.refs.mkString("REFS\n", "\n", "\n---")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could use the local convention
// checkConsistent() // DEBUG
which appears to have a special code
// println(owner.info.decls.toList.map(_.debugString).mkString("\n ")) // !!! DEBUG
or add config.Printers.lint
but frankly I never edit that config to enable printing. If I want to enable some typr.println
I just remove typr
. The many layers of just getting debug output from a test means I don't get debug output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if that's on purpose then it's fine, thanks for explaning!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, normally I have been deleting it, but I've written it a few times now. Uncommented would definitely be accidental; I should add the DEBUG for easy grepping. Or maybe just add the debug printer for lint. I will try that when fully caffeinated.
def show(s: String) = s | ||
extension (s: String)(using Show) // warn not used in repeat | ||
def echo = println(summon[Show].show(s)) | ||
def repeat = s * 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's OK if the warning is repeated for a second method. Alternatively, collect warnings by "site" and/or "origin" for helpful grouping. Maybe a future enhancement.
Fixes #23125
Make the message more verbose by stating the extension method name.
This could be improved by only adding words if the param pos is on a different line from the method pos.